home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 6_3.lha / 6_3 / tst1.c < prev    next >
Text File  |  1993-08-08  |  1KB  |  50 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <strclass.h>
  6. include <substr.h>
  7.  
  8. ain()
  9.  
  10.    string w = "abcdefghijklmnop";
  11.    string x = "0123456789wxyz";
  12.    cout << "w=" << w;
  13.    cout << "x=" << x;
  14.    cout << "w(5)=" << w(5);
  15.    string y = w(5,3);
  16.    cout << "y=w(5,3)=" << y;
  17.    cout << "x(-5)=" << x(-5);
  18.    cout << "x(-5,3)=" << x(-5,3);
  19.    cout << "x(0)=" << x(0);
  20.    cout << "x(0,2)=" << x(0,2);
  21.    cout << "x(11,8)=" << x(11,8);
  22.    cout << "x(8,4)=" << x(8,4);
  23.  
  24.    cout << "\nx=" << x;
  25.    x(2,2) = string("$$");
  26.    cout << "x(2,2)='$$'\n";
  27.    cout << "x=" << x << "\n";
  28.  
  29.    string z = x;
  30.    cout << "\nz=" << z << "x=" << x;
  31.    x(8,4) = string("WXYZ");
  32.    cout << "x(8,4)='WXYZ'\n";
  33.    cout << "x=" << x << "z=" << z << "\n";
  34.  
  35. ifdef TSTD
  36.    z = x;
  37.    cout << "\nz=" << z << "x=" << x;
  38.    x(2,6) = string("QQQQ");
  39.    cout << "x(2,6)='QQQQ'\n";
  40.    cout << "x=" << x << "z=" << z << "\n";
  41.  
  42.    z = x;
  43.    cout << "\nz=" << z << "x=" << x;
  44.    x(8,2) = string("!!!!");
  45.    cout << "x(8,2)='!!!!'\n";
  46.    cout << "x=" << x << "z=" << z << "\n";
  47. endif
  48.    return 0;
  49.  
  50.